import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/home/Home.vue'

Vue.use(Router)

export default new Router({
  // mode: 'history', //不能用history模式,会影响ios识别二维码，长按不会有识别二维码选项，安卓正常
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home
    },
    {
      path: '/WordPage',
      name: 'WordPage',
      component: () => import('./views/setWord/WordPage.vue')
    },
    {
      path: '/PowerListPage',
      name: 'PowerListPage',
      component: () => import('./views/powerListPage/PowerListPage.vue')
    },
    {
      path: '/GiftPage',
      name: 'GiftPage',
      component: () => import('./views/giftPage/GiftPage.vue')
    },
    {
      path: '/HelpingFriends',
      name: 'HelpingFriends',
      component: () => import('./views/helpingFriends/HelpingFriends.vue')
    },
    {
      path: '/GiftInformation',
      name: 'GiftInformation',
      component: () => import('./views/giftInformation/GiftInformation.vue')
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { x: 0, y: 0 }
    }
  }  
})
